package com.atguigu.sugar.mapper;

import com.atguigu.sugar.bean.Kw;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lzc
 * @Date 2022/6/2 14:27
 */
public interface KwMapper {
    @Select("SELECT\n" +
        "    keyword,\n" +
        "    sum(multiIf(source = 'search', 10, 5) * keyword_count) AS score\n" +
        "FROM dws_traffic_source_keyword_page_view_window\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY keyword")
    List<Kw> kw(@Param("date") int date);
}
